﻿<%@ Page Language="C#" MasterPageFile="~/Hoso/MasterPage_Hoso.master" AutoEventWireup="true" CodeFile="QuanlyTaikhoan.aspx.cs" Inherits="Hoso_QuanlyTaikhoan" %>
<%@ Register TagPrefix="uc" TagName="Menu" Src="~/Hoso/QuantriMenu.ascx"%>


<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
    &lt;&lt;&lt;&lt;&lt;&lt;&lt; .mine
 <div style="padding-left:10px">
    <asp:HyperLink ID="HyperLink1" runat="server" ForeColor="#336600" 
        NavigateUrl="~/Hoso/QuanlyTaikhoan.aspx" Font-Underline="False">QUẢN LÝ TÀI 
     KHOẢN</asp:HyperLink>
        <br />
        <br />
        <asp:HyperLink ID="HyperLink7" runat="server" ForeColor="#336600" 
        NavigateUrl="~/Hoso/QuanlyPhumuc.aspx" Font-Underline="False">QUẢN LÝ TÌNH 
     TRẠNG TÀI KHOẢN</asp:HyperLink>
         <br />
         <br />
    <asp:HyperLink ID="HyperLink3" runat="server" ForeColor="#336600" 
        NavigateUrl="~/Hoso/QuanlyThanhvien.aspx" Font-Underline="False">QUẢN LÝ 
     THÀNH VIÊN</asp:HyperLink>
         <br />
         <br />
         <asp:HyperLink ID="HyperLink8" runat="server" ForeColor="#336600" 
        NavigateUrl="~/Hoso/QuanlyPhumuc.aspx" Font-Underline="False">QUẢN LÝ TÌNH 
     TRẠNG THÀNH VIÊN</asp:HyperLink>
         <br />
         <br />
          <asp:HyperLink ID="HyperLink4" runat="server" ForeColor="#336600" 
        NavigateUrl="~/Hoso/QuanlyChuyenmuc.aspx" Font-Underline="False">QUẢN LÝ 
     CHUYÊN MỤC</asp:HyperLink>
         <br />
         <br />
         <asp:HyperLink ID="HyperLink9" runat="server" ForeColor="#336600" 
        NavigateUrl="~/Hoso/QuanlyPhumuc.aspx" Font-Underline="False">QUẢN LÝ TÌNH 
     TRẠNG CHUYÊN MỤC</asp:HyperLink>
         <br />
         <br />
           <asp:HyperLink ID="HyperLink5" runat="server" ForeColor="#336600" 
        NavigateUrl="~/Hoso/QuanlyPhumuc.aspx" Font-Underline="False">QUẢN LÝ PHỤ MỤC</asp:HyperLink>
         <br />
         <br />
         <asp:HyperLink ID="HyperLink10" runat="server" ForeColor="#336600" 
        NavigateUrl="~/Hoso/QuanlyPhumuc.aspx" Font-Underline="False">QUẢN LÝ TÌNH 
     TRẠNG PHỤ MỤC</asp:HyperLink>
         <br />
         <br />
           <asp:HyperLink ID="HyperLink6" runat="server" ForeColor="#336600" 
        NavigateUrl="~/Hoso/QuanlyBaiviet.aspx" Font-Underline="False">QUẢN LÝ BÀI 
     VIẾT</asp:HyperLink>
         <br />
         <br />
         <asp:HyperLink ID="HyperLink11" runat="server" ForeColor="#336600" 
        NavigateUrl="~/Hoso/QuanlyPhumuc.aspx" Font-Underline="False">QUẢN LÝ TÌNH 
     TRẠNG BÀI VIẾT</asp:HyperLink>
         <br />
         <br />
         <asp:HyperLink ID="HyperLink2" runat="server" ForeColor="#336600" 
        NavigateUrl="~/Hoso/QuanlyPhumuc.aspx" Font-Underline="False">QUẢN LÝ DANH 
     MUC XÉT NGHIỆM</asp:HyperLink>
         <br />
         <br />
         
         </div>
    =======
    <uc:Menu id="menu" runat="server"/>
    &gt;&gt;&gt;&gt;&gt;&gt;&gt; .r78   
</asp:Content>

<asp:Content ID="Content3" runat="server" contentplaceholderid="ContentPlaceHolder3">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
     <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">

            <script type="text/javascript">
            function RowDblClick(sender, eventArgs)
            {
              sender.get_masterTableView().editItem(eventArgs.get_itemIndexHierarchical());
            }
            </script>

        </telerik:RadCodeBlock>
        
         <!-- load ajax-->
         <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                    
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
        </telerik:RadAjaxManager>
        <!-- end-->
   
   <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" 
            BackColor="#99FF66" Skin="WebBlue" />
    <asp:Label ID="Label1" runat="server" Text=""></asp:Label> 
    <asp:Label ID="Label2" runat="server" Text=""></asp:Label>
    <telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" Width="627px"
        AllowSorting="True" AutoGenerateColumns="False" CellSpacing="0" 
        AllowAutomaticInserts="True" AllowAutomaticUpdates="True" AllowAutomaticDeletes="True"
        DataSourceID="SqlDataSource1" GridLines="None" 
        ondatabound="RadGrid1_DataBound" onitemdeleted="RadGrid1_ItemDeleted" 
        oniteminserted="RadGrid1_ItemInserted" 
        onitemupdated="RadGrid1_ItemUpdated" Skin="Office2007" 
        onitemcommand="RadGrid1_ItemCommand" PageSize="5" 
       >
          <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
            </HeaderContextMenu>
            <MasterTableView AutoGenerateColumns="False" DataKeyNames="mataikhoan" DataSourceID="SqlDataSource1" CommandItemDisplay="Top">
                <CommandItemSettings ExportToPdfText="Export to PDF" />
                <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                    <HeaderStyle Width="20px" />
                </RowIndicatorColumn>
                <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
                    <HeaderStyle Width="20px" />
                </ExpandCollapseColumn>
                
                <Columns>
                    
                    <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColum" FilterControlAltText="Filter EditCommandColumn column">
                    </telerik:GridEditCommandColumn>
                    
                    <telerik:GridBoundColumn 
                        FilterControlAltText="Filter mataikhoan column" HeaderText="Mã tài khoản" DataField="mataikhoan" DataType="System.Int32"
                         SortExpression="mataikhoan" UniqueName="mataikhoan">
                    </telerik:GridBoundColumn>
                    
                    <telerik:GridBoundColumn 
                        FilterControlAltText="Filter tentaikhoan column" DataField="tentaikhoan" SortExpression="tentaikhoan"
                        HeaderText="Tên tài khoản" UniqueName="tentaikhoan">
                    </telerik:GridBoundColumn>
                    
                    <telerik:GridBoundColumn 
                        FilterControlAltText="Filter password column" HeaderText="Password" DataField="password" SortExpression="password"
                        UniqueName="password">
                    </telerik:GridBoundColumn>
                    
                    <telerik:GridDropDownColumn FilterControlAltText="Filter mathanhvien column" DataField="mathanhvien" ListTextField="tenthanhvien" ListValueField="mathanhvien"
                       DataSourceID="SqlDataSource2" HeaderText="Thuộc thành viên" UniqueName="mathanhvien" ColumnEditorID="GridDropDownColumnEditor1" SortExpression="mathanhvien">
                    </telerik:GridDropDownColumn>
                    
                    <telerik:GridDropDownColumn FilterControlAltText="Filter mavaitro column" DataField="mavaitro" ListTextField="tenvaitro" ListValueField="mavaitro"
                       DataSourceID="SqlDataSource3"  ColumnEditorID="GridDropDownColumnEditor2" SortExpression="mavaitro"
                        HeaderText="Vai trò" UniqueName="mavaitro">
                    </telerik:GridDropDownColumn>
                    
                       <telerik:GridDropDownColumn FilterControlAltText="Filter matinhtrangtk column" DataField="matinhtrangtk" ListTextField="tentinhtrangtk" ListValueField="matinhtrangtk"
                       DataSourceID="SqlDataSource4" ColumnEditorID="GridDropDownColumnEditor3" SortExpression="matinhtrangtk"
                        HeaderText="Tình trạng" UniqueName="matinhtrangtk">
                    </telerik:GridDropDownColumn>
                    
                   <telerik:GridButtonColumn ConfirmText="Delete tài khoản ?" ConfirmDialogType="RadWindow"
                        ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete"
                        UniqueName="DeleteColumn">
                    </telerik:GridButtonColumn>
                </Columns>
                
                <EditFormSettings EditFormType="Template" ColumnNumber="2" CaptionDataField="mataikhoan" CaptionFormatString="Edit properties of Product {0}" InsertCaption="New Taikhoan">
                    <EditColumn UniqueName="EditCommandColumn1" FilterControlAltText="Filter EditCommandColumn column">
                    </EditColumn>
                    <FormTemplate>
                    <table id="Table2" cellspacing="2" cellpadding="1" width="100%" border="0" rules="none"
                        style="border-collapse: collapse; background: white;">
                        <tr class="EditFormHeader">
                            <td colspan="2" style="font-size: small">
                                <b>Thêm tài khoản</b>
                            </td>
                        </tr>  
        <tr>
            <td style="width: 152px">
                Tên tài khoản</td>
            <td style="width: 203px">
                <asp:TextBox ID="txttentaikhoan" runat="server" Text='<%# Bind("tentaikhoan") %>'></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="nhập tên tk" ControlToValidate="txttentaikhoan"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td style="width: 152px">
                Password</td>
            <td style="width: 203px">
                <asp:TextBox ID="txtpassword" runat="server" Text='<%# Bind("password") %>'></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="nhập pass" ControlToValidate="txtpassword"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td style="width: 152px">
                Thuộc thành viên</td>
            <td style="width: 203px">
                <asp:DropDownList ID="dropmathanhvien" runat="server" Width="100px"  SelectedValue='<%# Bind("mathanhvien") %>'
                                                DataTextField="tenthanhvien" TabIndex="7" DataValueField="mathanhvien" DataSourceID="SqlDataSource2"
                                                AppendDataBoundItems="True">
                <asp:ListItem Selected="True" Text="Select" Value=""></asp:ListItem>
                </asp:DropDownList>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ErrorMessage="chọn thành viên" ControlToValidate="dropmathanhvien"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td style="width: 152px">
                 Vai trò</td>
            <td style="width: 203px">
                <asp:DropDownList ID="dropmavaitro" runat="server" Width="100px" SelectedValue='<%# Bind("mavaitro") %>'
                                                DataTextField="tenvaitro" TabIndex="7" DataValueField="mavaitro" DataSourceID="SqlDataSource3"
                                                AppendDataBoundItems="True">
                 <asp:ListItem Selected="True" Text="Select" Value=""></asp:ListItem>
                </asp:DropDownList>
                 <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ErrorMessage="chọn vai trò" ControlToValidate="dropmavaitro"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td style="width: 152px">
                Tình trạng<br />
            </td>
            <td style="width: 203px">
                <asp:DropDownList ID="dropmatinhtrang" runat="server" Width="100px" SelectedValue='<%# Bind("matinhtrangtk") %>'
                                                DataTextField="tentinhtrangtk" TabIndex="7" DataValueField="matinhtrangtk" DataSourceID="SqlDataSource4"
                                                AppendDataBoundItems="True">
                <asp:ListItem Selected="True" Text="Select" Value=""></asp:ListItem>
                </asp:DropDownList>
                 <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ErrorMessage="chọn tình trạng" ControlToValidate="dropmatinhtrang"></asp:RequiredFieldValidator>
                <br />
            </td>
        </tr>
        <tr>
         <td align="right" colspan="2">
                                 <asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
                                    runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'>
                                </asp:Button>&nbsp;
                                        <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False"
                                        CommandName="Cancel"></asp:Button>
                                  
                                 
                            </td>
        </tr>
                    </table>
                    </FormTemplate>
                </EditFormSettings>
            </MasterTableView>
            <ClientSettings EnableRowHoverStyle="true">
               <Selecting AllowRowSelect="True" />
               <ClientEvents OnRowDblClick="RowDblClick" />
           </ClientSettings>
            <FilterMenu EnableImageSprites="False">
            </FilterMenu>
    </telerik:RadGrid>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:forumConnectionString %>" 
        SelectCommand="SELECT * FROM [TAIKHOAN]" 
        ConflictDetection="CompareAllValues" 
        DeleteCommand="DELETE FROM [TAIKHOAN] WHERE [mataikhoan] = @original_mataikhoan AND [tentaikhoan] = @original_tentaikhoan AND [password] = @original_password AND [mathanhvien] = @original_mathanhvien AND [mavaitro] = @original_mavaitro AND [matinhtrangtk] = @original_matinhtrangtk" 
        InsertCommand="INSERT INTO [TAIKHOAN] ([tentaikhoan], [password], [mathanhvien], [mavaitro], [matinhtrangtk]) VALUES (@tentaikhoan, @password, @mathanhvien, @mavaitro, @matinhtrangtk)" 

        OldValuesParameterFormatString="original_{0}" 

        
        UpdateCommand="UPDATE [TAIKHOAN] SET [tentaikhoan] = @tentaikhoan, [password] = @password, [mathanhvien] = @mathanhvien, [mavaitro] = @mavaitro, [matinhtrangtk] = @matinhtrangtk WHERE [mataikhoan] = @original_mataikhoan AND [tentaikhoan] = @original_tentaikhoan AND [password] = @original_password AND [mathanhvien] = @original_mathanhvien AND [mavaitro] = @original_mavaitro AND [matinhtrangtk] = @original_matinhtrangtk"> 

    
        <DeleteParameters>
            <asp:Parameter Name="original_mataikhoan" Type="Int32" />
            
            <asp:Parameter Name="original_tentaikhoan" Type="String" />
            <asp:Parameter Name="original_password" Type="String" />
            <asp:Parameter Name="original_mathanhvien" Type="Int32" />
            <asp:Parameter Name="original_mavaitro" Type="Int32" />
            <asp:Parameter Name="original_matinhtrangtk" Type="Int32" />
            
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="tentaikhoan" Type="String" />
            <asp:Parameter Name="password" Type="String" />
            <asp:Parameter Name="mathanhvien" Type="Int32" />
            <asp:Parameter Name="mavaitro" Type="Int32" />

            <asp:Parameter Name="matinhtrangtk" Type="Int32" />
            <asp:Parameter Name="original_mataikhoan" Type="Int32" />
            
            <asp:Parameter Name="original_tentaikhoan" Type="String" />
            
            <asp:Parameter Name="original_password" Type="String" />
            <asp:Parameter Name="original_mathanhvien" Type="Int32" />
            <asp:Parameter Name="original_mavaitro" Type="Int32" />
            <asp:Parameter Name="original_matinhtrangtk" Type="Int32" />
            
        </UpdateParameters>
        <InsertParameters>
            <asp:Parameter Name="tentaikhoan" Type="String" />
            <asp:Parameter Name="password" Type="String" />
            <asp:Parameter Name="mathanhvien" Type="Int32" />
            <asp:Parameter Name="mavaitro" Type="Int32" />

            <asp:Parameter Name="matinhtrangtk" Type="Int32" />
        </InsertParameters>
    </asp:SqlDataSource>
   
    
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
        ConnectionString="<%$ ConnectionStrings:forumConnectionString %>" 
        SelectCommand="SELECT [mathanhvien], [tenthanhvien] FROM [THANHVIEN]">
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
        ConnectionString="<%$ ConnectionStrings:forumConnectionString %>" 
        SelectCommand="SELECT [mavaitro], [tenvaitro] FROM [VAITRO]">
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource4" runat="server" 
        ConnectionString="<%$ ConnectionStrings:forumConnectionString %>" 
        SelectCommand="SELECT [matinhtrangtk], [tentinhtrangtk] FROM [TINHTRANGTK]">
    </asp:SqlDataSource>
</asp:Content>
